package com.example.demo.heima.netty.server;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;

import java.nio.charset.StandardCharsets;

/**
 * ******************************************************
 *
 * @author liugh9
 * @version 1.0
 * @classname TcpStickHalfHandler1
 * @description
 * @date 2023/07/24 21:26
 * <p>
 * ******************************************************
 */
@Slf4j
public class TcpStickHalfHandler1 extends ChannelInboundHandlerAdapter {
    int count = 0;

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        ByteBuf buf = (ByteBuf) msg;
        count++;
        log.info("---服务端收到的第{}个数据:{}", count, buf.toString(StandardCharsets.UTF_8));
        super.channelRead(ctx, msg);
    }
}